#include <iostream>
#include "standar.h"
#include "io52223.h"
#include "Rectangular.h"
#include "Polar.h"
#include "Operation.h"

static const int limiteSup = 100;

int main( void )
{
   Action accion;
/*CREATING OBJECTS*/
//create a operator object in heap memory (Dinamic memory)          
   Operation * operatorComplex =new Operation;    
//create three complex number rectangular Object in stack
   static Rectangular numR1, numR2, respR;        
//create three complex number polar Object
   static Polar numP1,numP2,respP;                

 /*AGORITHM*/
//set a value to complex numbers in a Rectangular format
   numR1.setReal(10);  numR1.setImaginary(10); 
   numR2.setReal(20);  numR2.setImaginary(20);
//make an addtion num1+num2 and make a multiplication
//using "->" and reference pass by reference

//Pre-condition
   if(numR1.getReal() < limiteSup && numR2.getReal() < limiteSup  )  {
      accion=operatorComplex->sum(numR1,numR2,respR);                
   }
//Post-condition
   if(accion == SUCCESS){
      cout << "The answer of the additon: Real = " << (int)respR.getReal()<<endl; 
   }else{
      cout << "Problem to make a sum" << endl; 
   }
  
//using "(*Objetc) and reference pass by punters
   (*operatorComplex).multiplication(&numR1,&numR2,&respR);   
   cout << "The answer of the multiplication: Real = " << (int)respR.getReal() 
      <<endl;

//set a values to complex numbers in a Polar format
   numP1.setMagnitude(10);  numP1.setAngle(Pi);
   numP2.setMagnitude(10);  numP2.setAngle(Pi);
   (*operatorComplex).sum(numP1,numP2,respP);               
//using "(*Objetc) and reference pass by reference
   cout << "The answer of the additon: Magnitude = " << (int)respP.getMagnitude() 
        <<endl;
   operatorComplex->multiplication(&numP1,&numP2,&respP);     
//using "->" and reference pass by punters
   cout << "The answer of the additon: Angle = " << (int)respP.getAngle() <<endl;
   delete operatorComplex;
   return 0;
}

